// FactoryPattern.cpp : Defines the entry point for the console application.
// This program demonstrates a the factory pattern, a factory allows the creation of one or more
// objects on runtime, this is usefull when serveral objects of subclasses needs to be created 
// A example is in a game, to create enemys or items

#include "stdafx.h"
#include "Shape.h"
#include "Factory.h"


int _tmain(int argc, _TCHAR* argv[])
{

	Shape *Object1 = Shape::MakeShape(1);
	Shape *Object2 = Shape::MakeShape(2);

	Object1->GetType();
	Object2->GetType();

	// Create a factory
	CarFactory *Factory = new CarFactory();

	// Create objects on run time
	Car *CarObject1 = Factory->CreateCar("Toyota");
	Car *CarObject2 = Factory->CreateCar("Doge");

	CarObject1->GetType();
	CarObject2->GetType();

	return 0;
}

